package org.feng.service.impl;

import jakarta.annotation.Resource;
import org.feng.entity.Columns;
import org.feng.manager.InformationSchemaManager;
import org.feng.service.ColumnService;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 列服务实现
 *
 * @author 01434188
 * @version 1.0
 * @since 2025-05-07 14:11
 */
@Service
public class ColumnServiceImpl implements ColumnService {

    @Resource
    private InformationSchemaManager informationSchemaManager;

    @Override
    @Tool(name = "findAllColumns", description = "根据schema和表名，查询当前数据库下的对应数据库表字段信息，包含字段名，字段类型，字段备注。")
    public List<Columns> findAllColumns(@ToolParam(description = "表的schema，即数据库名") String tableSchema, @ToolParam(description = "表名") String tableName) {
        return informationSchemaManager.findAllColumns(tableSchema, tableName);
    }
}

